<?php

namespace App\EventHandler;

use App\Event\Event;
use EasySwoole\Component\Di;
use EasySwoole\EasySwoole\Logger;

class DemoHandler extends HandlerBase{
    
    function handle(){
        // TODO: Implement handle() method.
        // 注册事件
        Event::getInstance()->set(Event::EVENT_DEMO, function(...$args){
            Logger::getInstance()->log('record level:ERROR-category:error log info', \EasySwoole\Log\LoggerInterface::LOG_LEVEL_ERROR, 'error');
            echo 'this is test event!' . json_encode(func_get_args()).':::'.time() .Di::getInstance()->get('$key'). PHP_EOL;
        });
        
    }
    
    
}